import api from "@/libs/request";
import { loginQl, refreshTokenQl } from "@/graphql/user";

// 用户登录
export const userLoginApi = (params: API.User.LoginParam) => {
  return api<API.User.LoginRes>({
    skipToken: true,
    query: loginQl,
    variables: params
  });
};

// 刷新用户 token
export const refreshTokenApi = async (refreshToken: string) => {
  const res = await api<API.RefreshTokenRes>({
    skipToken: true,
    query: refreshTokenQl,
    variables: { refreshToken }
  });
  return res.refreshToken;
}